<?php
require_once('../class/config.php');

$messageId = '1';
$messageRecipient = '';
$sendTime = date('Y-m-d');
$messageSender = SERVICE_NO_ID;
$relatedMessageId = '';
$readingValue = '123';
$estimated = false;
$readingStartDate = date('Y-m-d');
$readingEndDate = date('Y-m-d');
$id = 'X1';
$name = 'client name';
$postalAddress = '';
$startDate = date('Y-m-d');
$endDate = date('Y-m-d');
$phone = '';
$client = new Client_ES2_client($id, $name, $postalAddress, $startDate, $endDate, $phone);
//$client = 'T2NO2.12.123';

$meterData = new Client_ES2_meterData($messageId, $messageRecipient, $sendTime, $messageSender, $relatedMessageId, $readingValue, $estimated, $readingStartDate, $readingEndDate, $client);
$submitMeterData = new Client_ES2_submitMeterData($meterData);

$clientContract = new Client_ES2_clientContractMessage();
$submitEndContract = new Client_ES2_submitEndContract($clientContract);

/*
$soapClient = new Client_ES2_ElectricitySupplierServiceImplService();
//var_dump($soapClient->__getFunctions());
try {
//    print_r($soapClient->hello($hello));
    print_r($soapClient->submitMeterData($submitMeterData));
//    print_r($soapClient->SendMeteringReadings($sendMeteringReadings));
} catch (SoapFault $exception) {
    print_r($exception);
}
*/

$client = new Client_ES2();


echo $client->sendMeterReading($submitMeterData) ? 'OK' : 'NOT';
echo "===\n";
print_r($client->result);

/*
echo $client->sendSupplyTermination($submitEndContract) ? 'OK' : 'NOT';
echo "===\n";
print_r($client->result);
*/
/*
echo $client->sendSupplyTermination($sendSupplyTerminationMessage) ? 'OK' : 'NOT';
print_r($client->result);
*/